package com.sa07.user.service;

import java.util.List;

import com.sa07.bean.User;
import com.sa07.exception.DatabaseExecuteFailedException;
import com.sa07.user.dao.IUserDao;
import com.sa07.user.dao.UserDao;

/**
 * 用户业务类
 * 
 * @author Long.shangbo
 *
 * 2014-2-21 下午3:47:01
 */
public class Userservice implements IUserService {

	private IUserDao userDao = new UserDao();

	@Override
	public List<User> queryAllUser() throws DatabaseExecuteFailedException {
		return userDao.queryAllUser();
	}

	@Override
	public User login(int userId, int roleId, String userPwd) throws DatabaseExecuteFailedException {
		User user = userDao.login(userId, roleId, userPwd);
		
		if(user != null && user.getPassword().equals(userPwd)){
			return user;
		}
		
		return null;
	}

}
